package cn.zyq.charging.user.service.impl;

import cn.zyq.charging.user.mapper.ChargingUserInfoMapper;
import cn.zyq.charging.user.pojo.dto.ChargingUserInfoDTO;
import cn.zyq.charging.user.pojo.po.ChargingUserInfoPO;
import cn.zyq.charging.user.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
@Slf4j
public class UserServiceImpl implements UserService {


    @Autowired
    private ChargingUserInfoMapper chargingUserInfoMapper;

    //通过用户id去用户余额表查询用户余额 charging_user_info
    public ChargingUserInfoDTO getUserBalance(Integer userId){
        ChargingUserInfoPO chargingUserInfoPO=chargingUserInfoMapper.selectById(userId);
        ChargingUserInfoDTO chargingUserInfoDTO=new ChargingUserInfoDTO();
        BeanUtils.copyProperties(chargingUserInfoPO,chargingUserInfoDTO);
        return chargingUserInfoDTO;
    }

}
